fixing bug where Promise.resolve(null) throws