Fixes 'schedule test/issue#2268' crashes
Merge pull request #5595 from dumganhar/schedule-test-crash

Fix of  'schedule test/issue#2268' crashes