rewrite copy_quoted_string

- this fixes a bug where it wouldn't write a null terminator; seriously how did i not catch this before