fixed a bug related to function composition