Spot on dn88. It all depends on the article.I feel that "were" is used correctly here.
There were a number of sonnets written by Shakespeare.
I may be wrong, but I think it depends on the article preceding the word "number".
So if we use "the" (definite article), then we have singular, e.g.
The number of car accidents has tripled.
Any opinions of native speakers?