Bugfix in rewrites