Fix endianness issues