Fixing rewrites