Port the changes from contao/core@1269dd47108e5812ea33ee16c4177ad589b78aaa