Python3 and other bug fixes