defins some functions in onconnect_do