added state method to Deferred.