fix TypeError in python3