Fixed some casting warnings