As I explained in class there are certain contexts where "were" is used instead of "was". Actually, "was" is ungrammatical in these cases although natives do not usually know it. It has to do with the subjunctive mood.
Check it out: Subjunctive More on the subjunctive