fix dead loop issue