Fix weird casts