Add some OSX support
Fix uint64 warnings across platforms and architectures