if and while fix