diff --git a/RTCP/Cobalt/OutputProc/src/FastFileStream.cc b/RTCP/Cobalt/OutputProc/src/FastFileStream.cc
index 7398ee58ea452dec9c0ca05edb70b0cb894bb501..8db289c0d2cb700b0bc0cd1d86c50e847508ab2b 100644
--- a/RTCP/Cobalt/OutputProc/src/FastFileStream.cc
+++ b/RTCP/Cobalt/OutputProc/src/FastFileStream.cc
@@ -80,13 +80,14 @@ namespace LOFAR
     {
       if (remainder) {
         // pad with zeroes
+        size_t nrpadbytes = alignment - remainder;
         ensureBuffer(alignment);
-        memset(buffer.get() + remainder, 0, alignment - remainder);
+        memset(buffer.get() + remainder, 0, nrpadbytes);
         forceWrite(buffer, alignment);
 
         remainder = 0;
 
-        return alignment;
+        return nrpadbytes;
       }
 
       return 0;
@@ -176,7 +177,7 @@ namespace LOFAR
 
       // get rid of the old remainder first
       if (bytes + remainder >= alignment) {
-        bytes -= (writeRemainder() - remainder);
+        bytes -= writeRemainder();
 
         if (bytes >= alignment ) {
           // skip whole number of blocks
diff --git a/RTCP/Cobalt/OutputProc/src/FastFileStream.h b/RTCP/Cobalt/OutputProc/src/FastFileStream.h
index 966167032f7a9a3aeaf5d8816417f3b6be8a0270..5b1c4335f83d3a46a627de78eb8bfa950c9505d6 100644
--- a/RTCP/Cobalt/OutputProc/src/FastFileStream.h
+++ b/RTCP/Cobalt/OutputProc/src/FastFileStream.h
@@ -43,9 +43,9 @@ namespace LOFAR
       virtual size_t size();
 
       // formally, the required alignment for O_DIRECT is determined by the file system
-      static const unsigned alignment = 512;
+      static const size_t alignment = 512;
     private:
-      // writes the remainder, padded with zeros if needed. Returns the number of bytes written.
+      // writes the remainder, padded with zeros if needed. Returns the number of zero-pad bytes written.
       size_t writeRemainder();
 
       // we only support writing