Fix stack depth calculation in `make_function`.