Added server-side error handling