fixed i++ on j loop