mode rewrite and doc fix