Add a value reset operation in the error handling.

  Without this fix, the regression test fails with debug-builded binary.