fixed index_fn in RewriteTyped