Some python 3 compatibility
Some more fixes