errr reversed my logic and index typo