fixed generation bugs