Port the changes from contao/core@c35d1e426469fa10eb810cd70b39e22046b24c02