Convert while to do ... while

Signed-off-by: crynobone <crynobone@gmail.com>