fixed function call with trees