Jian changed one R function