fix bugs and change functionInvoker api.