Fix IndexOutOfBound Fail and implement according test (maybe the other way around)