fixed sleep and loop