fixed handling ncol(x) == 0