fixed catastrophic bug in sleep timing