Fixed error in if statement