Some fixes in auto-reconnect