Bugfix in scheduler