Fixed many resource-leak bugs. Hopefully all of them
Merge branch 'hax' of github.com:KoRE0/KoRE into hax