Port the changes from contao/core@c8a8e53e2ebb6a46055a736196a8b664631d37a1