Fix bug in fall through optimization.

Also refactor to_table to take an optional flag
to enable fall-through optimization.s