fixes some issues when retrying error jobs