Fixed issues with quaternion implementation.