fix bugs for cyclebuf