Fix a few holes in the RobustMergeJobs

Patch touches many basic places and it had some errors. These
were catched in the unit tests and it is now fixed.

Let's wait until Jenkins is back and then if it approves we can merge, I'll also make a double check on the patch with my test agent.