More fixes

Hi, we fixed more memory related issues. I was able to bring it up with Windows 7 & VC 2010 after tweaking the compiler options. Feel free to merge.