Fixed memory leaks
Fix missing init