Bug fixed causing getNextJob not return the correct value