Fix bounds on i variable which writes to 'notes'