added callbacks to error and end methods for workers