added some error handling to the server