Fixed the generator bug