check if the query is not canceled before calling the callback