fix race conditions in jobstateimpl, deals with failure well now