Improve resource release