Corrected some error handling based on server response.