Added unit test and fix issue #2 the case of less jobs than queue size in the stack