Added panic for negative idx