Fixed some 64-bit problems