For issue 395, also trigger callbacks when undoing/redoing, bug fixes, and more tests