Added checksum integrity support

Added checksum integrity support and fixed a few typecast bugs