Fix bug with set timeout. Add client mutex.