improve construct_url