diff --git a/src/FqBaseBackend.cpp b/src/FqBaseBackend.cpp
index 74c8a6ae552f9b305c9673bb16a8af5f828eec34..1e85010146184ab5e98335205bad61cec38cf614 100644
--- a/src/FqBaseBackend.cpp
+++ b/src/FqBaseBackend.cpp
@@ -112,7 +112,8 @@ void FqBaseBackend::writeToOutput(const unsigned long& offset) {
 
     int fq_rec_size=getRead(offset,pos_in_w_buf); // here aim is to avoid multiple strcpy into buffer: read directly at the right place in the buffer.
 #ifdef DEBUG
-    cout<<*(pos_in_w_buf+fq_rec_size-1)<<endl;
+    cout<<"read "<<fq_rec_size<<" char from offset: "<<offset<<" and stored them in o_buf at position: "<<pos_in_w_buf<<endl;
+    cout<<"last char read: "<<*(pos_in_w_buf+fq_rec_size-1)<<endl;
     assert(*(pos_in_w_buf+fq_rec_size-1)=='\n');
     assert(*(pos_in_w_buf)=='@');
 #endif
@@ -147,12 +148,14 @@ int FqBaseBackend::getRead(const unsigned long& offset, char * fq_record) {
     }
     nread=read(i_f_desc,fq_record,MAX_FQ_RECORD_LENGTH);
 #ifdef DEBUG
+    assert(nread<=MAX_FQ_RECORD_LENGTH);
     assert(*(fq_record)=='@');
+    cout<<"read: "<<nread<<" char from input file"<<endl;
 #endif
     nb_lines=0;
     i=1;
     pchar=fq_record;
-    while(i<nread) {
+    while(i<=nread) {
         if (*pchar=='\n') {
             nb_lines++;
             if (nb_lines==4) {
@@ -163,5 +166,8 @@ int FqBaseBackend::getRead(const unsigned long& offset, char * fq_record) {
         pchar++;
         i++;
     }
+#ifdef DEBUG
+    cout<<"found that fq record size is : "<<fq_rec_size<<endl;
+#endif
     return fq_rec_size;
 }