Some 64-bit compilation fixes (hopefully this didn't break everything else)