Fix bug related to returning inside of generator.

You should not be returning inside of a generator.