Tiny improvement to string checking.

A trivial follow-up to @niallrobinson's rather cunning #1053.