Minor bugfix (force numeric on data where creating a boldf) and refactoring (mostly in stats.R)