entity rewrite