fix pbc error in distance2