updates for latests critcl
fix memory leak
remove unused struct