fixes for python3 based on chat example
fix more examples