better error handling for controllers.