fix matrix transformation bug