bug fixing with pathname and base_dir