Corrected `os.path.ispath` to `os.path.isdir`