Fix one bug and copy some code to serverport