fix clear text and added reser() in C++ since constructor is not usable to reset buffer state