Improve exception handling when trying to send back job results.
Make heartbeat start before fetching input to prevent invalid crash detection.