if-else not in right order

Stupid mistake