Fix query problem