Port the changes from contao/core@b6f5d0861be639654c5b019fcf7e035903e77a27