Comment some missing code and fix the variable R