More cleaning when entering error cases