I think I have fixed the path making algorithm.

Or rather, identified the problem. Columns were going out of bounds.
added a -1 to the right limit. I now need to finish the fix