Handle assertions correctly when generalizing