Fixed bug in dict query