     # The result will be wrong when target page is too short anyway.
     @_scrolling = true
 
-    $(window).stop().scrollTo "##{mode}", 500,
+    target = @refs["page-#{mode}"]
+
+    return unless target
+
+    $(window).stop().scrollTo target, 500,
       onAfter: =>
         # Manually set the mode to avoid confusion (wrong highlight).
         # Scrolling will obviously break it but that's unfortunate result

    anchorHeight = window.innerHeight * 0.5

    if osu.bottomPage()
      @_setMode _.last(pages).id
      return

    # FIXME: I don't remember why this one scans from bottom while


          div
            key: m
            ref: "page-#{m}"
            'data-id': m
            className: topClassName
            el elem, props
