fixed support for generators: catch exception when rewinding a generator to prevent errors like "Cannot rewind a generator that was already run"