Corrected resource leak