Correct length calculation when writing TXT records