fix add missing put thread to sleep in else branch