Fixes and some enhancements for auto-automatch

Well, I had already left stuff broken with my previous merge, so I figured I couldn't do much more damage with one that tried to fix it.