Rewrite native function caller (fix #277)