Fix bugs in mean and sd related to column count check.

Change length implementation to use nrow and ncol instead of directly
touching inspect result.