Fix API query issue