More improvements to detect inactive connections