Fixed errors in using promise + added an assertion
Fixed errors in using promise + added an assertion