Handle HISTORY command properly