Fixed bug that removed the wrong job from buffer

As a result, the improved scheduler is not as good as it appeared (but
still better than simple scheduler)