Fix broken queries in API.