Added set_stat function.