fix some bugs in BlockMatrix