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

...n the stack