added support for matrices with missing data