use fgetc/ungetc in fscanf; properly fixes #1436