Index: /trunk/Cosy/main/MStarguider.cc
===================================================================
--- /trunk/Cosy/main/MStarguider.cc	(revision 16763)
+++ /trunk/Cosy/main/MStarguider.cc	(revision 16764)
@@ -1,3 +1,4 @@
 #undef EXPERT
+#define FACT
 
 #include "MStarguider.h"
@@ -1643,23 +1644,24 @@
 
     unsigned short *f = myimg;
-    byte *i = img;
-    byte *e = img+768*576;
-
-    while (i<e)
-        *f++ += *i++;
+
+    const byte *end = img+768*576;
 
     if (n%fIntRate)
+    {
+        while (img<end)
+            *f++ += *img++;
         return false;
-
-    f = myimg;
-    i = img;
-    e = img+768*576;
-
-    while (i<e)
-        *i++ = (byte)(*f++/fIntRate);
-
-    memset(myimg, 0, sizeof(myimg));
-
-    return true;
+    }
+    else
+    {
+        while (img<end)
+        {
+            *img = (*img + *f)/fIntRate;
+            ++img;
+            *f++ = 0;
+        }
+
+        return true;
+    }
 }
 
