rewriting to avoid an uglify bug