fixed encode/decode url functions