fix agent connect when socket variable is not defined