Make storing and restoring of zoom and scroll position more reliable