Various fixes to the server code