added resource ownership check