fixed a bug in the error wrapper