enhance debug log and fix a small issue
implement server connect feature