optimize string comparisons. fixes #743