Patching substring call. Wasn't clearing out the buffer correctly.....:/