Fix an edge case where the promise might be resolved before .then() can be called.
Add a validation layer. Todo: doc for it.