fix #6480

This is my first contribution so I hope I have followed the guidelines correctly.