Fix python 3 compatibility

Fix python 3 compatibility