some fixes to scheduler