fixed bugs in server script