fix matrix cat bug