fix some bugs, add the server