Fix put-string! and put-sexp!.

Thanks to Seth Alves for reporting the bug and providing a patch.