Fixes statistics stored procedure