modified version of bcprov