Fix issue 935: error in matrix calculation
Merge pull request #1051 from fsantini/EZ_fix935

Fix issue 935: error in matrix calculation