db query builder bugfix