Minor Python3 compatibility and style issues