fix recovery on error