HHServer

Fix some bugs and optimze the code.