Fix big/little endian conversion