Fixed a bug in compiling the R package