Port the changes from contao/core@579c290a735aacf7b2adc108995c7a241a58050d