fixed bug in inter matrix computation
update test code