while condition fix