[squash] change order of conditions in the while loop