Fix segfault in MPI runs with HEX smearing, miscellaneous small issues elsewhere.