Fixed endianness which was sometimes wrong