Improved some debug rules to avoid undoing.

Just noticed that you setting and undoing some properties. Fixed that to make more DRY.