Fix for a potential memory leak

I replaced the code in the URL method since Xcode noticed a potential memory leak.