diff --git a/src/sphere/sphere.cpp b/src/sphere/sphere.cpp
index 8c6ac48388b121609cfb70bc7c83e3b59d17f11a..f7135caa71d2a0127ca25b6e1773d758aa4f47a1 100644
--- a/src/sphere/sphere.cpp
+++ b/src/sphere/sphere.cpp
@@ -223,6 +223,7 @@ void sphere(string config_file, string data_file, string output_path) {
       tppoan.write(reinterpret_cast<char *>(&nph), sizeof(int));
       tppoan.write(reinterpret_cast<char *>(&nths), sizeof(int));
       tppoan.write(reinterpret_cast<char *>(&nphs), sizeof(int));
+      tppoan.write(reinterpret_cast<char *>(&nsph), sizeof(int));
 
       for (int nsi = 0; nsi < nsph; nsi++)
 	tppoan.write(reinterpret_cast<char *>(&(sconf->iog_vec[nsi])), sizeof(int));