Resolves bug reports https://bugs.openfoam.org/view.php?id=2601 and https://bugs.openfoam.org/view.php?id=2602