Fixed the bug where the sort order of transactions with equal timestamps
was not stable, i.e. due to the lack of a total order, different merges
produced different sortings and hence messed up transactions which
have already been merged.
Added unit test.
Implemented a quick fix for the issue with a broken branch-off algorithm
which disregarded the transaction boundaries in the undo.data file.