Fixes in scheduler. Sleep finished but does not pass the test.
Lot of fixes. Sleep test is passed.