added support for big endian