"""
     customizations.sort()
     h = hash(tuple(customizations))
+
     pdf_name = '%s-custom-%s' % (book.fileid(), h)
-    pdf_file = models.get_dynamic_path(None, pdf_name, ext='pdf')
+    pdf_file = get_dynamic_path(None, pdf_name, ext='pdf')
+
     return pdf_file
 
 
             current_self.pdf_file.save('%s.pdf' % self.fileid(),
                     File(open(pdf.get_filename())))
             self.pdf_file = current_self.pdf_file
+
+            # remove cached downloadables
+            remove_zip(settings.ALL_PDF_ZIP)
+
+            for customized_pdf in get_existing_customized_pdf(self):
+                unlink(customized_pdf)
         else:
             print "saving %s" % file_name
             print "to: %s" % DefaultStorage().path(file_name)
             DefaultStorage().save(file_name, File(open(pdf.get_filename())))
 
-        # remove cached downloadables
-        remove_zip(settings.ALL_PDF_ZIP)
-        for customized_pdf in get_existing_customized_pdf(self):
-            unlink(customized_pdf)
-
     def build_mobi(self):
         """ (Re)builds the MOBI file.