Some fixes for python3