Fix bad pattern matches.
Add debugging.