fixed bug, verified working for small matrix