Backport history implementation changes from backbone.flashback.