fix generator bug