finish metadata rewrite