fix access to array element by using the one that was checked for
Merge pull request #14 from mikey179/patch-1

fix access to array element by using the one that was checked for