Fixed the rotation issues to deal with non-orthogonal