Preserving current state before rewrite