Fix placing ci=>1 for complete_file(), add logging