Style changes and minor bug fixes according to pylint