add connect, fix bug