python 3 compatibility fix
Merge pull request #2775 from stefan-w/python-3-fix

python 3 compatibility fix