Fix: Big mistake in intmat3. I was integrating over x,y,s rather than the required x,y,h. Changed intmat3 using double while loop.