emit matrices properly