added fixes to make finallink creation work on subdirectories