Port the changes from contao/core@ab257040b929596f19beb85effee7fbd5ebd6116