Fixed minor bug in scheduler