Fix computation of done state

issue3550
review3011002