I vaguely remember a few years ago I reported a crash to Arkshine when using unregister_message inside the message hook directly. I think it was fixed, but as I said, it was a long time ago so I don't properly remember.
So, are you using 1.8.2? If so, try delaying the unregister_message call with a 0.1 task.