Modifying momh_stats function to make it work on PHP 5.3