bug fix and client reconnect