Fixed small issue

Array counts to n-1 now, not to n which caused some problems