Fixed newly introduced query bug.
Fixed incorrect log text.