fix bugs found when runs server