fixed bad generation logic