reduce the mistake of dead loop