Some fixes to issues that could cause client hangs.