fixed a glitch in matrix doc addition method