fix cell indexing issue