Fix some test cases failign becaus changed dot-scripted-defaults
Fix another bug because returning deferred instead of promise.