fixing generator bug