Clean up err checking