Fixed some server related bugs