diff --git a/tools/PeriodicTable/generate_atom_code.py b/tools/PeriodicTable/generate_atom_code.py
index 030cb3c39b70b79c292f827b48865e6eaa833d73..6827ab0b10015a849b672f72dbc5f1b0c5c79780 100755
--- a/tools/PeriodicTable/generate_atom_code.py
+++ b/tools/PeriodicTable/generate_atom_code.py
@@ -30,13 +30,13 @@ def writeMiddle(handle, abundance, atom):
         if density is None:
             density = "NAN"
         else:
-            desnity = str(density)
+            density = str(density)
     except TypeError:
         density = "NAN"
     handle.write("%f, %f, %s" % (abundance, mass, density))
 
 def writeEnd(handle):
-    handle.write(");\n");
+    handle.write(");\n")
 
 def writeIsotope(handle, element, atomicnumber):
     isotope = element._isotopes[atomicnumber]