Pull request for Issue 6399

This is a fix for issue #6399. I hope I followed all of the correct procedures.