Fix endian issue (with test)