Port the changes from contao/core@cf108bab2436e109e9f729ba16eb9b375f8065e3