Fixed few memory leaks
Merge remote-tracking branch 'miktam/bug/memory_leak'