added mcmcdb_unflatten and misc methods