small update to generate()