Fixing some bugs with python3 handling