Fix remaining memory leaks, fix problem with 63cca8f
Merge branch 'staging'