refine url shorten logic