Fix issue where value for sql clause was being added twice