Test for the existence of 'stats' variables before increment them.
Remove use of PHP shut-up (@) operator