forgot to add an upper limit index check