correct url generation logic