Better error handling for workers