Fixed API query bug