Add logbuffer and fixed some bug
Add mutex lock and conditin