Made fixes to scheduler