Replace stat tracking with atomics
Fix for old PHP versions