fix bugs and add socket.io