Checked the length on the wrong array