fixing a bug in completed job handling