fixed several issues in generators.