Correcting if statement