small changes to server and thread