fix while statement