support promise and thunk. fixed #6