correcting spawn job child code and added spawn job parent code