fixes #5267 in master branch