fixed bad if statement