Fixed several memory leaks.
Merge branch 'testing' into bugfix