Memory leaks fix #1 (some additions)

Fixed merge losses