endianness handling for big endian systems