Fixed bug pointed by canard (out of bounds reading and a big mistake in j upper limit)
Changed paths: