Fixed minor issues with set and add(index,element) methods