diff --git a/src/audio/audiolayer.cpp b/src/audio/audiolayer.cpp
index 34c6bf3782d913ad5faf1969157bbcc652e34990..e36640f54cf45bd1514811ee76d289b1c6df1673 100644
--- a/src/audio/audiolayer.cpp
+++ b/src/audio/audiolayer.cpp
@@ -34,7 +34,10 @@ AudioLayer::AudioLayer(ManagerImpl& manager)
   , _micRingBuffer(SIZEBUF)
   , _stream(NULL), _manager(manager)
 {
+  _debugInit("   portaudio initialization...");
   portaudio::System::initialize();
+  _debugInit("   portaudio end initialization.");
+  NBCHARFORTWOINT16 = sizeof(int16)/sizeof(unsigned char) * CHANNELS;
 }
 
 // Destructor
@@ -83,7 +86,8 @@ AudioLayer::openDevice (int index)
 	     2, portaudio::INT16, true, 
 	     portaudio::System::instance().deviceByIndex(index).defaultLowInputLatency(), 
 	     NULL);
-	 
+	
+  // we could put 0 instead of FRAME_PER_BUFFER to be variable
   portaudio::StreamParameters const params(inParams, outParams, 
 					   SAMPLING_RATE, FRAME_PER_BUFFER, paNoFlag);
 		  
@@ -190,43 +194,39 @@ AudioLayer::audioCallback (const void *inputBuffer, void *outputBuffer,
   int urgentAvail, // number of int16 right and int16 left
       normalAvail, // number of int16 right and int16 left
       micAvailPut;
+  unsigned short spkrVolume = _manager.getSpkrVolume();
+  unsigned short micVolume  = _manager.getMicVolume();
 
   // AvailForGet tell the number of chars inside the buffer
   // framePerBuffer are the number of int16 for one channel (left)
-  // so we divise by short/char * 2 channels
-  int NBCHARFORTWOINT16 = sizeof(int16)/sizeof(unsigned char) * CHANNELS;
-	urgentAvail = _urgentRingBuffer.AvailForGet() / NBCHARFORTWOINT16;
+  framesPerBuffer *= NBCHARFORTWOINT16;
+	urgentAvail = _urgentRingBuffer.AvailForGet();
 	if (urgentAvail > 0) {  
 	// Urgent data (dtmf, incoming call signal) come first.		
 		toGet = (urgentAvail < (int)framesPerBuffer) ? urgentAvail : framesPerBuffer;
-		_urgentRingBuffer.Get(out, toGet * NBCHARFORTWOINT16, _manager.getSpkrVolume());
+		_urgentRingBuffer.Get(out, toGet, spkrVolume);
 		
 		// Consume the regular one as well (same amount of bytes)
-		_mainSndRingBuffer.Discard(toGet * NBCHARFORTWOINT16);
+		_mainSndRingBuffer.Discard(toGet);
 	}  
 	else {
 	// If nothing urgent, play the regular sound samples
-		normalAvail = _mainSndRingBuffer.AvailForGet() / NBCHARFORTWOINT16;
+		normalAvail = _mainSndRingBuffer.AvailForGet();
 		toGet = (normalAvail < (int)framesPerBuffer) ? normalAvail : framesPerBuffer;
 
-   // _debug("mainsndringbuffer.get: %d vs %d : %d\n", normalAvail, (int)framesPerBuffer, toGet);
-   // fprintf(stderr, "%p:%d:%d:%ud\t",out,toGet*NBCHARFORTWOINT16,normalAvail,framesPerBuffer);
    if (toGet) {
-		  _mainSndRingBuffer.Get(out, toGet*NBCHARFORTWOINT16, _manager.getSpkrVolume());
+		  _mainSndRingBuffer.Get(out, toGet, spkrVolume);
     } else {
-      toGet = framesPerBuffer * NBCHARFORTWOINT16;
-      //fprintf(stderr, "put zero... %d (in bytes)\n", toGet);
+      toGet = framesPerBuffer;
       _mainSndRingBuffer.PutZero(toGet);
       _mainSndRingBuffer.Get(out, toGet, 100);
     }
 	}
 
 	// Additionally handle the mic's audio stream 
-  short micVolume = _manager.getMicVolume();
   micAvailPut = _micRingBuffer.AvailForPut();
   toPut = (micAvailPut <= (int)framesPerBuffer) ? micAvailPut : framesPerBuffer;
-  _micRingBuffer.Put(in, SAMPLES_SIZE(toPut), micVolume );
-  //fprintf(stderr, "|mic:%p|", in);
+  _micRingBuffer.Put(in, toPut, micVolume );
 
 	return paContinue;
 }
diff --git a/src/audio/audiolayer.h b/src/audio/audiolayer.h
index 21559fd0f82ef3455e7ce7cb95f15727dad09415..9261b7a4e16dd278be49d998e3d0fe4c25631d00 100644
--- a/src/audio/audiolayer.h
+++ b/src/audio/audiolayer.h
@@ -70,9 +70,10 @@ private:
 	RingBuffer _micRingBuffer;
 
 	portaudio::MemFunCallbackStream<AudioLayer> *_stream;
-	portaudio::AutoSystem autoSys;
+//	portaudio::AutoSystem autoSys;
   ost::Mutex _mutex;
   ManagerImpl& _manager;
+  int NBCHARFORTWOINT16;
 };
 
 #endif // _AUDIO_LAYER_H_
diff --git a/src/audio/ringbuffer.cpp b/src/audio/ringbuffer.cpp
index 662f784c6a6ecf289716bc6a4c1c80e115280933..0a18386eb9abef4ca297e03a52f178acedc52d18 100644
--- a/src/audio/ringbuffer.cpp
+++ b/src/audio/ringbuffer.cpp
@@ -35,14 +35,11 @@ RingBuffer::RingBuffer(int size) {
    mStart = 0;
    mEnd = 0;
    mBuffer = new unsigned char[mBufferSize];
-   mBlank = new unsigned char[MIN_BUFFER_SIZE];
-   bzero(mBlank, MIN_BUFFER_SIZE);
    assert (mBuffer != NULL);
 }
 
 // Free memory on object deletion
 RingBuffer::~RingBuffer() {
-   delete[] mBlank;   mBlank  = NULL;
    delete[] mBuffer;  mBuffer = NULL;
 }
  
diff --git a/src/audio/ringbuffer.h b/src/audio/ringbuffer.h
index db0d686feeab916b6a1ba6225a22064c4358f0d5..d474c56a4b484f13f543c500026941c61967f40b 100644
--- a/src/audio/ringbuffer.h
+++ b/src/audio/ringbuffer.h
@@ -62,7 +62,6 @@ class RingBuffer {
    int           mEnd;
    int           mBufferSize;
    samplePtr     mBuffer;
-   samplePtr     mBlank;
 };
 
 #endif /*  __RING_BUFFER__ */
diff --git a/src/gui/server/tcpstreampool.cpp b/src/gui/server/tcpstreampool.cpp
index 353914da0203ac0d448c2363215f946863c74bd7..41104d85f39e044289c3ff42eaf134f43370610a 100644
--- a/src/gui/server/tcpstreampool.cpp
+++ b/src/gui/server/tcpstreampool.cpp
@@ -19,11 +19,13 @@
 #include "tcpstreampool.h"
 #include "../../global.h"
 
+#define WAITING_TIME 10UL
+
 TCPStreamPool::~TCPStreamPool() 
 {
   terminate();
   std::string output;
-  while (good() && _outputPool.pop(output, 2LU))  {
+  while (good() && _outputPool.pop(output, WAITING_TIME))  {
     *this << output << std::endl;
   }
 }
@@ -35,7 +37,7 @@ TCPStreamPool::run() {
   char cr13 = '\r'; // we don't want carriage return in empty line
 
   while(!testCancel() && good()) {
-    while (isPending(ost::TCPSocket::pendingInput, 2LU)) {
+    while (isPending(ost::TCPSocket::pendingInput, WAITING_TIME)) {
       std::getline(*this, input);
       //_debug("TCPStreamPool getline %s\n", input.c_str());
       if (input != null && input[0]!=cr13) {
@@ -44,7 +46,7 @@ TCPStreamPool::run() {
       // security check, since we are inside a loop
       if (testCancel() || !good()) {break;}
     }
-    if (_outputPool.pop(output, 2LU)) {
+    if (_outputPool.pop(output, WAITING_TIME)) {
       //_debug("TCPStreamPool send %s\n", output.c_str());
       *this << output << std::endl;
     }
@@ -62,7 +64,7 @@ TCPStreamPool::send(const std::string& response)
 bool 
 TCPStreamPool::receive(std::string& request)
 {
-  return _inputPool.pop(request, 2LU);
+  return _inputPool.pop(request, WAITING_TIME);
 }