stats: Corrected minor execution errors and applied best practice