You're incrementing i in the j loop, not j :P