Some python3 improvements