diff --git a/src/DBManager.cpp b/src/DBManager.cpp
index 1bd0a60a37af9fc1eab8efe747218a5511bfe216..f308f79c90bac9ceaed53eb22c7b59bcaab621ed 100644
--- a/src/DBManager.cpp
+++ b/src/DBManager.cpp
@@ -136,7 +136,8 @@ boost::posix_time::ptime DBManager::retrieveLastTimestamp()
 
    std::tm tm_time;
 
-    *m_auxSession_sp << "select coalesce(last_timestamp,'1970-01-01 00:00:00')"
+   //FIXME: max return null, otherwise coalesce does not work
+    *m_auxSession_sp << "select coalesce(max(last_timestamp),'1970-01-01 00:00:00')"
         << " from "<< m_configuration_sp->getAuxDatabaseSchema()
         << "." << m_configuration_sp->getAuxDatabaseTimestampTable()
         << " where device_name like :deviceName",
diff --git a/src/ProtocolManager.cpp b/src/ProtocolManager.cpp
index 8a9e1966770404519265a9c4554ec2fa74852bc0..9a3cc450d1caa239e2b3e9950472cac94f9ad56c 100644
--- a/src/ProtocolManager.cpp
+++ b/src/ProtocolManager.cpp
@@ -131,7 +131,7 @@ RequestSP ProtocolManager::createRequest() throw(std::runtime_error)
 {
     DEBUG_STREAM << "ProtocolManager::createNewFileRequest()" << endl;
 
-    if(hasNewFile())
+    if(!hasNewFile())
         throw std::runtime_error("New file list is empty");
 
     RequestSP request_sp(new Request);
@@ -197,8 +197,10 @@ FileWrapper::SP ProtocolManager::processResponse(ResponseSP response_sp)
         << " transfer file " << fileName << " version "
         << fileVersion << " size " << fileSize << endl;
 
-    boost::filesystem::path path = composePath(m_configuration_sp->getStoragePath(),
-        filePath, fileVersion, fileName);
+//    boost::filesystem::path path = composePath(m_configuration_sp->getStoragePath(),
+//        filePath, fileVersion, fileName);
+
+    boost::filesystem::path path(fileName);
 
     return FileWrapper::create(m_deviceImpl_p, path, fileSize);
 }