Clean up of error treatment