It is difficult to say from your post here without seeing your script etc. Have you considered doing the math in the controller? Basically create three integer words, i.e., Flow_Old, Flow_New and then a Flow_Result that will store the result of the subtraction between Flow_Old and Flow_New. Then just send the result to inTouch which you say is working no problem.
Probably not the answer you’re looking for but maybe a work-around until you get your script sorted out.