Fixes #6676 and #7375