fix for older clang
fix for writing non-null-terminated strings