fixed indexoutofbounds on test case 1