Fix CLI buffer bug