add -d option for destination directory
set debug using flag
fix handling of no exists directory