try to fix flattenTerms by changing klist and klabel to label format