Port the changes from contao/core@c75c7d9a1a4f5d470b2f86fb60b6a771bb02e72f