removed bug in matrix hash