fix base_path for replace function