diff --git a/src/FqAuxBackend.cpp b/src/FqAuxBackend.cpp
index 0e785b054ee9d804fb26042a26136b1dc8323fa4..a17c28e391773b06065f9102c16fd5775ecccd16 100644
--- a/src/FqAuxBackend.cpp
+++ b/src/FqAuxBackend.cpp
@@ -127,7 +127,8 @@ int FqAuxBackend::processBuffer(rinfo * p_nr) {
 
 void FqAuxBackend::readBuffer() {
     if ((nread=read(f_desc,buf,bufsize))!=0) {
-        cur_offset=ftell(f_stream);
+        cur_offset=lseek(f_desc,0,SEEK_CUR);
+//ftell(f_stream);
         pos_in_buf=0;
     }
 }
diff --git a/src/FqMainBackend.cpp b/src/FqMainBackend.cpp
index b259f6642aa55048f0a5c2d9c940ef664b4c4945..72d1b15e98d952e1fec7442462137f713d886c4d 100644
--- a/src/FqMainBackend.cpp
+++ b/src/FqMainBackend.cpp
@@ -18,6 +18,7 @@
 //#define DEBUG
 
 #ifdef DEBUG
+#include <string.h>
 #include <iostream>
 using namespace std;
 #endif
@@ -53,7 +54,8 @@ void FqMainBackend::processFile(char * filename,unsigned char f_id) {
     if (fp==NULL) {
         err(errno,"cannot open file: %s.",filename);
     }
-    cur_offset=ftell(fp);
+    //cur_offset=ftell(fp);
+    //cout<<"cur_offset="<<cur_offset<<endl;
     char* buf=(char *) malloc(FqBaseBackend::bufsize*sizeof(char));
     if (buf==NULL) {
         err(errno,"cannot allocate memory: %lu bytes.",bufsize);
@@ -63,7 +65,9 @@ void FqMainBackend::processFile(char * filename,unsigned char f_id) {
         nb_read_oper++;
         //cout<<"BE1: read operation nbr: "<<nb_read_oper<<endl;
         //printf("going to call ftell on : %p \n",fp);
-        cur_offset=ftell(fp);
+        //cur_offset=ftell(fp); // don't know why but it seems that this doesn't work under linux; always returns 0...
+        cur_offset = lseek(f_single, 0, SEEK_CUR);
+        //cout<<"cur_offset="<<cur_offset<<endl;
         processBuf((char *)buf,nread,f_id,cur_offset);
     }
     close(f_single);
@@ -97,12 +101,16 @@ void FqMainBackend::processBuf(char * buf,int nread,unsigned char f_id,unsigned
             case k_read_id_start:
                 if (qual_score) goto inc_score;
                 else {
+                rstart_offset=cur_offset-nread+cnt;
 #ifdef DEBUG
+                cout<<"nread="<<nread<<endl;
+                cout<<"cnt="<<cnt<<endl;
+	        cout<<"rstart_offset="<<rstart_offset<<endl;
                 is_id=1;
                 idx_id=0;
                 nb_start++;
 #endif
-                rstart_offset=cur_offset-nread+cnt;
+                // rstart_offset=cur_offset-nread+cnt;
                 num_l_in_rec=1; }
                 break;
             case k_read_qual_start:
diff --git a/src/unit_test_fqreader.cpp b/src/unit_test_fqreader.cpp
index d40e7c224a28d9c2681bd85e36153784a2152daf..28e8d88f6bd48787bd2603ea0b9fce7daaaef8b8 100644
--- a/src/unit_test_fqreader.cpp
+++ b/src/unit_test_fqreader.cpp
@@ -7,6 +7,7 @@
  *      Keep using assert for the moment, don't want to add a dependency on boost (or any other test framework) just for the tests.
  */
 #include <stdio.h>
+#include <string.h>
 #include <iostream>
 #include <limits.h>
 #include <assert.h>
@@ -38,7 +39,8 @@ void test_processSingleFile() {
         assert(score==5);
         for (it_offs=rit->second.begin();it_offs!=rit->second.end();it_offs++) {
             unsigned long offset_quotient=it_offs->first;
-            assert(offset_quotient==0);
+            cout<<"offset_quotient="<<offset_quotient<<endl;
+	    assert(offset_quotient==0);
             for (it_struct=it_offs->second.begin();it_struct!=it_offs->second.end();it_struct++) {
                 unsigned char fid_stored=it_struct->fileid;
                 assert(fid_stored >>4==f_id);