error in if statements corrected