Added server script
Fixed some bugs on server.sh