check return value of fgets