Fixed a couple of things spotted by PyCharm's static analysis