Fixed if statement logic.