fix a tail buf repace bug