fixed $base_dir variable