One thing I can also say is that when I use uint16_t integers, the sketch work as expected. You can duplicate that it works with uint16_t by uncommenting the lines in my sketch that call the getAnalogOffset and writeAnalog offset functions and running it.