Port from marc3.0.16