fixing bugs and R dependencies