Fix query issue