Restoring the error handler

Restoring the error handler even if an exception occurs. 
This is something we have to do manually if we catch the Exception somewhere else.