copied from RPMD