generalize wf-fun invertsion