magic index problem added