> @larsmans in the block above you set Xf[p] for p in range(0, end-start). Here p runs from range(start, end) - is that correct?

+1, indices are not correct. Please make `p` ranges in `[start;end)` to avoid confusion with other parts of the code.