Fixed a bug that occured while changing the value of R