Fixed many 64 to 32 bit warnings