better auto-connect functionality