Port the changes from contao/core@756331ca802ddf0acf71ee210c4eb1f3d80a9e3f