Small issue in the implementation of submit job

Hey Marc, please review this patch, also I'm working on adding tests for this functionality , I will commit them soon