Fixed bug in tuple-matrix to generic6dReference conversion

Fixed a bug in last commit. Fork due to bad usage of "commit --amend."