fix generator-generating code and update tests