various improvements

fixed concurrency bug, added client-side query timeout