fix emit of done after errors