fixed an error when R is used in the middle of topology