Corrected the averaging for the case where the patch is decomposed for parallel running.