diff --git a/CanonicalNucleotideAtoms.py b/CanonicalNucleotideAtoms.py
index a608eb0b7732da7603fdbb52479d381d4743009c..f2eb3aebf9174757a54b22733d27503291d2dc23 100644
--- a/CanonicalNucleotideAtoms.py
+++ b/CanonicalNucleotideAtoms.py
@@ -59,8 +59,9 @@ class Nucleotide(Group):
             return seg._get_atomic_nucleotide(nt_idx, is_fwd)
 
 class CanonicalNucleotideFactory(Group):
-    # DefaultOrientation = rotationAboutAxis([0,0,1], 180)
-    DefaultOrientation = rotationAboutAxis([1,0,0], 180)
+    DefaultOrientation = rotationAboutAxis([0,0,1], 180).dot(
+        rotationAboutAxis([1,0,0], 180))
+
     def __init__(self, prefix, seq):
         self.sequence = seq     # TODO: used?
         self.resname = resnames[seq]
diff --git a/segmentmodel.py b/segmentmodel.py
index 16906cd32f690095e4300f3732f11318b252b98a..c45801f0b821ba05dd6f531baf210b6825ba6260 100644
--- a/segmentmodel.py
+++ b/segmentmodel.py
@@ -408,24 +408,29 @@ class Segment(ConnectableElement, Group):
 
     def contour_to_orientation(self,s):
         assert( isinstance(s,float) or isinstance(s,int) or len(s) == 1 )   # TODO make vectorized version
+
         orientation = None
         if self.quaternion_spline_params is None:
             axis = self.contour_to_tangent(s)
             axis = axis / np.linalg.norm(axis)
             rotAxis = np.cross(axis,np.array((0,0,1)))
             rotAxisL = np.linalg.norm(rotAxis)
-            theta = np.arcsin(rotAxisL)
 
             if rotAxisL > 0.001:
+                theta = np.arcsin(rotAxisL)
                 orientation0 = rotationAboutAxis( rotAxis/rotAxisL, theta*180/np.pi, normalizeAxis=False )
             else:
-                orientation0 = np.eye(3)
+                if axis.dot(np.array((0,0,1))) > 0:
+                    orientation0 = np.eye(3)
+                else:
+                    orientation0 = rotationAboutAxis( np.array((1,0,0)), 180, normalizeAxis=False )
             orientation = rotationAboutAxis( axis, self.twist_per_nt*self.contour_to_nt_pos(s), normalizeAxis=False )
             orientation = orientation.dot(orientation0)
         else:
             q = interpolate.splev( s, self.quaternion_spline_params )
             if len(q) > 1: q = np.array(q).T # TODO: is this needed?
             orientation = quaternion_to_matrix(q)
+
         return orientation
 
     def get_contour_sorted_connections_and_locations(self,type_):