Fixed index query issue