do isDirectory check earlier, fixes #51
0.5.2
Merge remote-tracking branch 'upstream/master'