Fix API calls and logging