fix duplicate objects after restoring data from localStorage

This makes sure that the originals of changed entities get merged
into the base of the stack after restoring the data from JSON.
This is necessary, because the stack will only have elements for
the current viewport after a restart and previously *modified*
objects will now be falsely detected as *created* ones.

Also removed some ineffective code.
add tests for "restoring from v3 JSON" (core/history.js)