posta il codice completo, anche dove usi file_exists.