fix bug wherein an unset logical operator creates invalid SQL