cleanup of pname and log