silly mistake =( i < n not n < i =(