Fixed bug in quaternion and updated its test case