Fix:getting 404 while trying to shorten

The check for the url value was placed even before it was accessed. Fixed that.