add error handling to worker