Fixes for Python3: indentation and library changes