Fix some problems with R resource

Please, as soon as possible pull from this branch to your workspace for the new changes