Port the changes from contao/core@5bd145c8dd13bdaaac4002583c38afc39e4c4c11