Port the changes from contao/core@ccdebeea4757eaee3411f7acb5bec6b513edae82