rewrite file_str_replace and using it in download