fixed problem with index and encoding issues