Fix for stats.mode to work on character arrays. Closes #3814