Fixed the bug where "connect" may return 0