ensure promise is always resolved