added error checking to prevent crashing in stats tab