Fix some problems with R resource