Attempted to fix bugs related to static variables not being reset