Added detection of app controller in error handlers and loading of modules.