Fix index bug in query file