Fixes a bug in the 3D rotation matrix generator