Error cleanup improved