fix the queries last api