Modify 'is_directory' check to fix directory symlink issue

This fixes #146.