prevent deadloops