Fixed bug #1128: sortmax not honored.