new glhck, fix memory leaks