Test for issue 6157

fixes #6157