fixed python3 imports and other python3 compat issues