JS fix for browser back button