fixed string index handling with references