Improved python3 compatibility of examples.