Fixed compatibility with python3 and other stuff