[R2D] Fixed resource disposing issues