added autodetection of machine endianness