mcmcdb_flatten_numeric: fix bugs