final working fix for scroll history