invert condition to simplify code