Fix reference-counting bugs caught by cpychecker.
Further simplification
Fix typos
Merge pull request #914 from mdboom/misc/cpychecker

Fix reference-counting bugs caught by cpychecker