Fixed missing end to if