fix log; use fgets instead of getline