Added nil checks to promise