Use isdir() method
Merge pull request #3 from cclauss/patch-2

Use isdir() method