more python3 compatibility fixes
refactored use of 'types' module (python3 portability fix)
added missing __next__ iterator method (python3 compatibility fix)