Fix handling of ngram S3 classes for case-insenstive searches