Various bug fixes.  Fixing generated code.