Save and restore state now works in the buffer