sparse: clean up spsolve code a bit + fix issues with vectors