correction on while loop condition