fixing multiple client problems. But locking is not working yet