string handling fixes, I haven't dealt with all of them but the template should make it an easy swap for strcpy in the future