Fixing endian code to work on windows