diff --git a/GraphRewriting/Layout/Rotation.hs b/GraphRewriting/Layout/Rotation.hs
--- a/GraphRewriting/Layout/Rotation.hs
+++ b/GraphRewriting/Layout/Rotation.hs
@@ -33,10 +33,11 @@
 momentum a impulse = Rotation . (+) (signum a * impulse (abs a)) . rotation
 
 angle ∷ Vector2 → Vector2 → Angle
-angle u v = sign ⋅ (acos $ vdot a b) where
+angle u v = sign ⋅ (acos $ bound $ vdot a b) where
 	sign = signum $ v2y b ⋅ v2x a - v2y a ⋅ v2x b
 	a = vnormalise u
 	b = vnormalise v
+	bound x = max (-1) (min 1 x) -- due to a rounding error in (vdot a b), acos might yield NaN
 
 rotate ∷ Angle → Vector2 → Vector2
 rotate a (Vector2 x y) = Vector2 (x ⋅ cos a - y ⋅ sin a) (x ⋅ sin a + y ⋅ cos a)
diff --git a/GraphRewriting/Layout/Wrapper.hs b/GraphRewriting/Layout/Wrapper.hs
--- a/GraphRewriting/Layout/Wrapper.hs
+++ b/GraphRewriting/Layout/Wrapper.hs
@@ -46,4 +46,5 @@
 wrapGraph ∷ Graph n → Graph (Wrapper n)
 wrapGraph = unsafeMapNodesUnique wrapNode where
 	wrapNode k n = Wrapper {wRot = Rotation 0, wPos = Position $ genPos k, wrappee = n}
-	genPos k = let f = fromIntegral k in rotate f (fromScalar f)
+	genPos k = rotate (fromIntegral k) (fromScalar f)
+		where f = fromIntegral $ k `mod` 3
diff --git a/graph-rewriting-layout.cabal b/graph-rewriting-layout.cabal
--- a/graph-rewriting-layout.cabal
+++ b/graph-rewriting-layout.cabal
@@ -1,5 +1,5 @@
 Name:           graph-rewriting-layout
-Version:        0.4.2
+Version:        0.4.3
 Copyright:      (c) 2010, Jan Rochel
 License:        BSD3
 License-File:   LICENSE
