Almost resolved bug with regrouping after undo.