Matrix Test cases & Debug Fixes