fix matrix output