fixed all contents[i] to contents.at(i)