Fixed bug in check for a promise, when type of promise is function and not object