Revert 893daf4 and add test for issue 8642

fixes #8642

#7993 should be reopened!