Fixing bug in rescheduling after restart