corrected behaviour of fgets