Somehow seems related to the recently corrected bug with /url, in that all your sendmessage communications is putting the scripting thread into an asynchronous , that is, losing synchronization.
If accessing the DLL from an On TEXT event, do the event identifiers also become null? $nick, $address, $target, $eventparms, etc?