r script fix