Bugfixes to the scheduling.