Fixed code to use wd promise api