Prevent while loop