Fix self-referencing table in codegen ( #619 )

Fixes #619
review by @szeiger