Revert "Fixes #5827"

This reverts commit c3caf5c40383389bb0bc7860805cd332f56e16a8.