fix couples of memory leak