fix memory corruption

using memcpy() for writing into a passed string argument is bad, mmkay?