fix bug in mergePopulations: now matrix is returned instead of a data frame