fixed generate_url()