Added server error handling