rewrite __native__io, new substr function.