Work around some weird permissions issues when running from Python 3.5
Fix bug in CPython version of is_dir()/is_file() when follow_symlinks=False