Fixed some server bugs