[bugfix] Fix a bug in error handling