Fixes #6268 #6122