fixed error in if statement