Fix some bugs in querying special indexed fields