Fixed error with resolve_query going out of scope