fixed endian bug