fixed up rewrites