bugfix in generate schedule matrix involving time window