Fixing if else statement