update to take account of endianness