Normally, we would use “was” with first or third person singular:
When I was a child, I thought like a child.
He was happier then.
But the subjunctive mood – which has almost become extinct in our language – changes the “was” to “were.”
If I were a carpenter, and you were a lady, I’d marry you anyway.
If he were to arrive to the meeting in time, I would pass out.
The subjunctive mood is used when writing something contrary to reality – a wish, a dream, or a an imaginative state.
We say “God bless you,” after someone sneezes, not “God blesses you,” which would be grammatically correct in the indicative mood. The subjunctive mood means that we wish or desire that God will bless the person. I think historically, a sneeze was believed to be an evil spirit that could lead to disease, but that’s another topic!
There are times when spell-checker/grammar checker seems to catch the subjunctive mood, but times when it doesn’t – so don’t rely on it. Learn the subjunctive mood yourself, and when to use “I were” instead of “I was.”