Fix URL generation bug