smaller updates to error handler (plus bugfix).