fix function events benchmarking code