fix example 1 to use Promise