fix bugs around R restart and scroll position