fix connect callback function