What happens if you add a check for null before using pointer remove?
You can also debug your code with the help of the Visual Studio debugger. You just need to convert the code to an engine SDK project. But I don't know how helpful this will be because you can't inspect what happens internally in Acknex and it's not possible to use wait-instructions. So you need to rewrite all functions that use wait.