added checksum and added a added some debugging warnings