Capture url in closure instead of dynamic var (fixes #1)