Added improvement for Error.prototype.toString
Improved error handling