Error in S_free[to, from] <- nextfree : subscript out of bounds