make BUF_CAPACITY const instead of static