fixed bug with nn on empty query