Added error handling to server module.