fix purity-plot script