fixed some bugs when selecting other pages from navigation and coming back to previous page