added loc rewriter