Fix casting defect