fix query problem