found some bugs in the endianness of double-length variables; not yet fixed