fix filepath if -d
Merge branch 'master' of https://github.com/wslfa/gryphon
remove duplicate code