Various bugs / imperfections spotted by pycharm.