Memory leaks fixed
Merge branch 'memory_fix' into devel