Port the changes from contao/core@eddcc1dd14ee9c7766ec63c3fbcb8fb988683243