fix rewrite rules