Fixed Index out of range check