Your enable and disable buttons aren't working very well, not at all actually. As it should read..
#CTCPREPLY on
..your code
#CTCTREPLY end
You need to take out this line:
if ( %CTCPREPLY == off ) || ( %CTCPREPLY == $null ) { return }
Make sure your codes check button code looks like..
if ($group(#CTCPREPLY) == on) { did -c $dname 41 }
if ($did(41).state == 1) { .enable #CTCPREPLY }
else { .disable #CTCPREPLY }