diff --git a/NIF_IO.cpp b/NIF_IO.cpp
index b4bc0a3dc14fea7180fee81925b02e2a700e4bea..9b03afa780b55b9a9176dbb0d69bf5f0a83f5185 100644
--- a/NIF_IO.cpp
+++ b/NIF_IO.cpp
@@ -281,9 +281,9 @@ void NifStream( ShortString & val, istream& in, uint version ) {
 };
 
 void NifStream( ShortString const & val, ostream& out, uint version ) {
-	byte len = byte( std::streamsize(val.str.size()) + 1 );
-	WriteByte( len, out );
-	out.write( val.str.c_str(), std::streamsize(val.str.size()) + 1 );
+	WriteByte( byte(val.str.size() + 1), out );
+	out.write( val.str.c_str(), std::streamsize(val.str.size()) );
+	WriteByte( 0, out );
 };
 
 ostream & operator<<( ostream & out, ShortString const & val ) {