change Promise to jQuery Deffered