fixes #5799 in master 2.5