error in if statement fixed