Fix imports on py2 and flake errors