Changed error handler define and setup order