Adding a call to sleep in a thread is causing a fault