Added safe_copy_string.
Merge branch '1.8' into 1.9