Fix python 3 and import errors