Fixed undo for subs