backport some of the position saving code from old incremental-reflow branches