Fix unsafe string handling