Port the changes from contao/core@99803088cbb69590a7d2842b21536ae4b14638d0