Errors when preparing a response now emit internalError correctly

Closes #713