fgets safety check added