Fixed error in stats class trying to use non-object