fixed issues with the refresh and back button