resource release bug fix