added debug for API calls