fix bug when composite functions