Code fixes

Various code fixes, mostly discovered by MSVC code static analyzer .
Right, it throws just like operator new.