Fix/while loop