Port the changes from contao/core@76b898af1ad64f7beb17fc8042d0ae2faa431e2f