revert isPromise and change only the condition inside function Q