fix bugs for function invoking.