Updated treatment of errors to give more information.