added compatibility between 32bit and 64bit (see ticket #1) and prepared hooks for endianness