Make sure we compare flavor IDs as ints

We were comparing an int to a string and getting things wrong, so
idempotence was lost. This forces the comparison to be int.
Remove errant debugging code

This should have never made it in.
Merge pull request #2799 from j2sol/flavor-int

Fix instance idempotence