Fixed a bug in error handler line 222-226