fix if statement cbind samples