better handling of the back button and scrolling