Fixed the code to preserve the exception traceback so that the debugging is simple.