Port the changes from contao/core@0afdc5950ae88150f0f3df9cdee6b2c81648ab81