Better cleanup after errors