Fixed translation of generator function