Fix casting issue