Update get_int and put_int to deal with endianness

N.B. sizeof(int) has to be 4. Maby get_int should be changed to get_long.