SQL MAX should be very easy to understand, but why my this query does not work as expected?

Here is the schema and data 

```
CREATE TABLE orders(
    id INT,
    name TEXT,
    quantity INT, 
    PRIMARY KEY (id)
);
INSERT INTO orders VALUES 
    (1, 'abc', 10), 
    (2, 'def', 3), 
    (3, 'abc', 2),
    (4, 'ghi', 4),
    (5, 'ghi', 7),
    (6, 'ghi', 13);

```

This is the query

```
select t.name, max(t.avgq) from (
    select name, avg(quantity) as avgq 
    from orders group by name
) as t;

```

The result I got from mysql and sqlfiddle are all like this

```
name    max(t.avgq)
-----+-------------
abc        8

```

Where it should actually be 

```
name    max(t.avgq)
-----+--------------
ghi        8

```

Why is that?