Fixes self-scanning option.

Fixed #355
Merge branch 'issue-372' into issue-355-2
Merge pull request #379 from k22mak/issue-355

Implement self-scanning option