fixed a few defects with threading in generator