fix bugs in server.R