fix bugs in write.con in server.R