corrected indexing in toC