Fix use of Promise API