add a guard on the sleep time.