Improved some debug rules to avoid undoing.