Fix logical expression merging.