Fix issues in history undo and redo. Add tests for Backbone.Collection's history.