Adding error checking for controller route change