Suggested fix for missing X.dmat bug