correcting a type error inside sleep