fix bugs in server.js