fix generator bugs