fixed bug on index, fixed failed tests