Fix type-erasure induced bug