removed global var from file_on_target and useless code