fix merge bug and add stringAsFactors param in as.data.frame