Fixed a few improper casting warnings and updated some of syntax.