Fix a problem introduced by c6989ab9f905ae27773140c8bf8c8e27ca4a6a1e. Avoid foreach on _items since that includes empty entries too.