Fixes #7310 and should also fix #7311