Fix generation crash