fix access to undefined promise