Fix bug with isPromise function