Fixed stat_function