add some dir/file existence check
move log and output dir out of bin dir