updated BUF_SIZE to 1024