Port the changes from contao/core@b3b993a0ef38f86cd30240647cade14a3b792d82