Issue #175: fix wrong column used in query