More style/robustness/spelling fixes courtesy of PyCharm warnings