Port the changes from contao/core@1913bf881d6c373cf129dd0a1e91d73e2e0dc59a