Fix code style of while loops