Made another, smarter modification using string_copy() to create a temp copy, then passed that to the function instead, thus making sure that nothing stomps on the global variable.