Fixed a bug i->i+1