diff --git a/pitivi/ui/mainwindow.py b/pitivi/ui/mainwindow.py
index b4c86ca..3702bc0 100644
--- a/pitivi/ui/mainwindow.py
+++ b/pitivi/ui/mainwindow.py
@@ -725,9 +725,9 @@ class PitiviMainWindow(gtk.Window, Loggable):
 
     def _setBestZoomRatio(self):
         ruler_width = self.timeline.ruler.get_allocation()[2]
-        timeline_duration = self.project.timeline.duration
+        timeline_duration = float(self.project.timeline.duration)
 
-        ideal_zoom_ratio = ruler_width / float(timeline_duration / gst.SECOND)
+        ideal_zoom_ratio = ruler_width / timeline_duration / gst.SECOND
         nearest_zoom_level = Zoomable.computeZoomLevel(ideal_zoom_ratio)
         Zoomable.setZoomLevel(nearest_zoom_level)
 
