Code fixes

Various code fixes, mostly discovered by MSVC code static analyzer .
Checked code.
Py_None must be a pointer to empty object, so fix is correct.