fixed bugs with indexing and inserting