performance tweak in functionWrapper