I recommend to check this. It is not unlikely that the problem is here.

According to the documentation, if you do word+integer, TP converts both to longint before doing the +, then, before doing the assignment, checks if the result is in [0..65535], and then converts back to word.