bug fix with misaligned matrices
bug fix with misaligned matrices