fix memory management problem
fix unintialized fields