fixed some discrepancies between serial and parallel versions