stray not in if statement returned wrong value