Added logging for API failure