Port the changes from contao/core@2dc2b3653a689da276b2e51c288537b59c3186fa