diff --git a/lib/stack_tracy/sinatra.rb b/lib/stack_tracy/sinatra.rb
index <HASH>..<HASH> 100644
--- a/lib/stack_tracy/sinatra.rb
+++ b/lib/stack_tracy/sinatra.rb
@@ -10,10 +10,9 @@ module StackTracy
 
     def call(env)
       request = ::Sinatra::Request.new env
-      if request.path.match /^\/tracy-?(.*)?/
-        return open($1)
+      if request.path.match /^\/tracy(-.*)?/
+        return open($1.to_s.gsub(/^-/, ""))
       end
-
       if @before_filter.nil? || !!@before_filter.call(request.path, request.params)
         result = nil
         stack_tracy @arg || Dir::tmpdir, @options do
@@ -28,7 +27,17 @@ module StackTracy
   private
 
     def open(match)
-      StackTracy.open match.to_s.empty? ? nil : match, (match.to_s.empty? && @arg.to_s != "dump" && !StackTracy.stack_trace.empty?)
+      if match.empty?
+        if StackTracy.stack_trace.empty?
+          StackTracy.open
+        else
+          StackTracy.dump do |file|
+            StackTracy.open file, true
+          end
+        end
+      else
+        StackTracy.open match
+      end
       [200, {"Content-Type" => "text/html;charset=utf-8", "Content-Length" => Rack::Utils.bytesize("").to_s}, ""]
     end
Improved StackTracy::Sinatra middleware a bit regarding the `/tracy` route