More checks to avoid IndexOutOfBounds Exceptions