add hashtext capability and fix memory leak