Fix casting warnings