modify check lock related and add reconnect logic