Changes in set_filename() function, to check the file_exist infinit times. Initially it was for only 100 times.