Corrected URL creation function.