fix urlcode logic