Fixed a syntax error caused by non-empty return in a generator