Fix some relative imports and python2 incompatibilities