Forgot to initialize loop counter to 0.