Fixed bug in url shortening

For some reason the previous method didn't work in Ruby 1.9 but it did in 2.0