Modified the error handler