I haven’t used aftouch in a long time but I give it a go when I get to a keyboard with aftertouch.
An alternative approach would be to read the data in using midiin and filter into the aftertouch data by using its status byte and channel (I can’t remember what the status byte for aftertouch will be but you could easily test to find out what this is by using midiin and print messages.
The status byte value appears to be 208 so you can try this and see if it works any better:
kstatus,kchan,kdata1,kdata2 midiin
if (kstatus==208 && kchan==1) then
kAftouch = kdata1
endif
printk2 kAftouch

