fixing some bugs in COM interop with C#