added fixes for both mvapich2 and openmpi builds