invert logic, get rid of infinite loop