fix function ApplyMatrices3.