Runtime Error C++ Runtime Library

I'm getting a runtime error each time I try to use the replace command.  It lets me replace the part, but then errors out when it trys to remate the part in the assembly.

I'm not sure what is causing this.  Any ideas?

Window 7 x64

SWX 2013 SP4.0

SolidworksApi macros