fixing mangle script