Fixed bugs in server