improve function invoke.