fixes #5598 in branch master 3.0