diff --git a/ipuz/structures/direction.py b/ipuz/structures/direction.py
index <HASH>..<HASH> 100644
--- a/ipuz/structures/direction.py
+++ b/ipuz/structures/direction.py
@@ -2,9 +2,9 @@
 
 def validate_direction(direction):
     splitted = direction.split(':')
-    direction_name = direction
     if len(splitted) > 2:
         return False
+    direction_name = direction
     if len(splitted) <= 2:
         direction_name = splitted[0]
     return direction_name in (
Minor change in logic for direction name calculation