Fixed leaks
Fixed freeing lists
Merge branch 'master' into plugins