Fix some generator bugs.