Compile fixes, clean up warnings
Add thread sleep in Mutex