added code to detect when we are off the path and react to it