Port the changes from contao/core@152410cbcab53d5fa358e96e39856868ae3397ec