Fix issues with connect/reconnect