removed undeclared index error