Fix bugs in generators