Fix symmetric_function merge logic