fix some bugs in connection expire check