fixes #1241
just by adding map.size() before query check
Merge remote-tracking branch 'origin/master'