fixed using i and j