Issue 45 backport issue 6757 from 3.0.1