change error structure to be a hash