Fixed the error message from popping up when navigating away from the page.