Fix sleep on error