WYRL: ok, I've figure out the main clue for what's going wrong with my modifications for #274.  The change I made to Automaton.rewrite() which swaps automaton states to make sure the rewritten state occupies the smaller position is what's causing the problem.  However, that change is necessary to make the rest of it work!!