Added more exception handling to server