Replace https in expand function