fix lazyCreation in code generator